package top.tangs.vitamin.dao.impl;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import top.tangs.vitamin.entity.Designer;
import top.tangs.vitamin.util.DBManager;

public class DesignerDaoImpl {
	public List<Designer>getUserList(){
		   List<Designer> list = new ArrayList<Designer>();
		   Connection conn = DBManager.getConnection();
		   Statement st = null;
		   ResultSet rs = null;
		   
		   try {
			st = conn.createStatement();
			rs = st.executeQuery("select * from Designer");
			 while(rs.next()) {
				 int designerld = rs.getInt("designerld");
				 String designerHeadPortaits = rs.getString("designerHeadPortaits");
				 String designerName = rs.getString("designerName");
				 String designerPosition = rs.getString("designerPosition");
				  
				  Designer d = new Designer(designerld,designerHeadPortaits,designerName,designerPosition);
				  
				   list.add(d);
			   }
			 return list;
		} catch ( SQLException e) {
			e.printStackTrace();
			return null;
		}finally {
			DBManager.closeAll(conn, st, rs);
		}
	   }
}

